NYR Conference 2024
The colon data come from a clinical trial of adjuvant therapy for colon cancer, and are included in the {survival} package.
Variables of interest:
| Variable | Variable description | Levels |
|---|---|---|
| rx | Treatment assignment | Obs(ervation), Lev(amisole), Lev(amisole)+5-FU |
| sex | Sex | 1=male, 0=female |
| years | Years to status | Continuous years |
| status | Censoring status | 0=censored, 1=recurrence |
See appendix slide for code to generate altered example data colonr.
Use survfit() to create the survival curves from which the median recurrence-free years and 95% confidence interval are obtained:
Run summary() on the survfit() object to estimate the 5-year recurrence-free probability and 95% confidence interval:
Use coxph() to fit univariate and multivariable Cox regression models:
Call:
coxph(formula = Surv(years, status) ~ rx, data = colonr)
coef exp(coef) se(coef) z p
rxLev -0.01512 0.98499 0.10708 -0.141 0.888
rxLev+5FU -0.51209 0.59924 0.11863 -4.317 1.58e-05
Likelihood ratio test=24.34 on 2 df, p=5.175e-06
n= 929, number of events= 468
Run plot() on the survfit() object to generate the Kaplan-Meier plot:
But what if we need to put our results in a reproducible and publication-ready report?
Use tbl_survfit() to create:
Use tbl_uvregression() to create:
Use tbl_regression() to create:
Tables are highly customizable, see https://www.danieldsjoberg.com/gtsummary/ for details and vignettes to get started
Use tbl_survfit() with the probs = 0.5 argument:
| Characteristic | Median (95% CI) |
|---|---|
| Overall | 5.5 (4.0, —) |
| Treatment | |
| Obs | 3.4 (2.2, 5.6) |
| Lev | 3.2 (2.2, 5.7) |
| Lev+5FU | — (—, —) |
Use tbl_survfit() with the times = 5 argument:
| Characteristic | 5-year RFS (95% CI) |
|---|---|
| Overall | 51% (48%, 54%) |
| Treatment | |
| Obs | 45% (40%, 51%) |
| Lev | 46% (41%, 52%) |
| Lev+5FU | 62% (56%, 67%) |
Save the tbl_survfit() result to an object (here, tab1) so that table statistics can be extracted for use inline with the inline_text() function.
The inline code:
The median (95% CI) recurrence-free time for the Levamisole treatment group is
`r inline_text(tab1, variable = rx, level = 'Lev', prob = 0.5)`.
Will show as:
The median (95% CI) recurrence-free time for the Levamisole treatment group is 3.2 (2.2, 5.7).
Use tbl_uvregression():
| Characteristic | N | HR1 | 95% CI1 | p-value |
|---|---|---|---|---|
| Treatment | 929 | <0.001 | ||
| Obs | — | — | ||
| Lev | 0.98 | 0.80, 1.21 | ||
| Lev+5FU | 0.60 | 0.47, 0.76 | ||
| Sex | 929 | 0.4 | ||
| Female | — | — | ||
| Male | 0.92 | 0.77, 1.10 | ||
| 1 HR = Hazard Ratio, CI = Confidence Interval | ||||
include =exponentiate = T to obtain hazard ratiosPass fitted model results directly to tbl_regression():
| Characteristic | HR1 | 95% CI1 | p-value |
|---|---|---|---|
| Treatment | <0.001 | ||
| Obs | — | — | |
| Lev | 0.99 | 0.80, 1.22 | |
| Lev+5FU | 0.60 | 0.47, 0.75 | |
| Sex | 0.3 | ||
| Female | — | — | |
| Male | 0.90 | 0.75, 1.08 | |
| 1 HR = Hazard Ratio, CI = Confidence Interval | |||
Uses {ggplot2} as the basis so known customizations are available with the + operator.
ggsurvfitggcumincggsurvfitOptions to:
See https://www.danieldsjoberg.com/ggsurvfit/ for details and vignettes to get started
https://www.linkedin.com/in/emily-zabor-59b902b7/
Link to slides: https://github.com/zabore/slidedecks/blob/master/2024-NYR-Zabor.html
colon dataset from {survival} altered to: